﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;



/// <summary>
/// 触发器检测事件
/// </summary>
public class TriggerEvent : MonoBehaviour 
{
    public GameObject targertEntered;
    //抛出的事件，对外接口
    public UnityEvent onOtherEnterEvent;
    private bool hasInvoke=false;

    void OnTriggerEnter(Collider other)
    {
        if (other.name== targertEntered.name)
        {
            Debug.Log("------------");
            if (onOtherEnterEvent != null&&hasInvoke==false)
            {
                onOtherEnterEvent.Invoke();
                hasInvoke = true;
            }
            
        }
    }

	

}
